package io.renren.modules.gis_admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.gis_admin.dao.ShpLegendDao;
import io.renren.modules.gis_admin.dto.ShpLegendDTO;
import io.renren.modules.gis_admin.entity.ShpLegendEntity;
import io.renren.modules.gis_admin.service.ShpLegendService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ${comments}
 *
 * @author Mark iu1340@163.com
 * @since 1.0.0 2023-08-31
 */
@Service
public class ShpLegendServiceImpl extends CrudServiceImpl<ShpLegendDao, ShpLegendEntity, ShpLegendDTO> implements ShpLegendService {

    @Override
    public QueryWrapper<ShpLegendEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String layerId = (String)params.get("layerId");

        QueryWrapper<ShpLegendEntity> wrapper = new QueryWrapper<>();
        if(id!=null){
            wrapper.eq(StringUtils.isNotBlank(id), "id",  Long.valueOf(id));
        }
        if(layerId!=null){
            wrapper.eq(StringUtils.isNotBlank(layerId), "layer_id", Long.valueOf(layerId));
        }

        return wrapper;
    }


}